package testsql;

public class Q55 {

	public static void main(String[] args) {
		Solution solution = new Q55.Solution();
		//int[] candidates = new int[]{2,3,1,1,4};
		int[] candidates = new int[]{3,2,1,0,4};
		System.out.println(solution.canJump(candidates));
	}
	
	public static class Solution {
	    public boolean canJump(int[] nums) {
	        int len = nums.length;
	    	boolean[] f = new boolean[len];
	        f[0] = true;
	    	for(int i=1; i<len; i++){
	        	for (int j = 0; j < i; j++) {
	        		if(f[i-1] && j+nums[j] >= i){
	        			f[i] = true;
	        			break;
	        		}
				}
	        }
	        return f[len-1];
	    }
	}

}
